package bupt.xixi.serializer;

import bupt.xixi.enumeration.Codec;

import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @author: wangc2h4
 * @date: 2021/10/7
 */
public class SerializerFactory {

    static Map<Integer, ICommonSerializer> serializerCache;

    static {
        serializerCache = new HashMap<>();
        serializerCache.put(Codec.SerializeType.KYRO.getCode(), new KryoSerializerI());
    }


    public static ICommonSerializer getByCode(int code) {
        if (!serializerCache.containsKey(code)) {
            return null;
        }
        return serializerCache.get(code);
    }
}
